# Maintainer: Michał Adamski <michal@ert.pl>
pkgname=libsecp256k1
pkgver=0.3.2
pkgrel=0
pkgdesc="Optimized C library for EC operations on curve secp256k1"
url="https://github.com/bitcoin-core/secp256k1"
arch="all"
license="MIT"
makedepends="autoconf automake libtool"
subpackages="$pkgname-dev"
source="https://github.com/bitcoin-core/secp256k1/archive/v$pkgver/secp256k1-v$pkgver.tar.gz"
builddir="$srcdir/secp256k1-$pkgver"

prepare() {
	default_prepare

	./autogen.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-static \
		--enable-module-ecdh \
		--enable-module-recovery \
		--disable-benchmark \
		--disable-exhaustive-tests \
		--disable-examples
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
18104b72dd5d1f5e776d72c31c36247e450736437b453b59cf6ec86f84fedeafcf231e266c1ddad727befd9864c65a779000d01e6cef4b9a6485850afebc8a81  secp256k1-v0.3.2.tar.gz
"
